﻿<UserControl x:Class="Projecturo.ProjecturoClient.View.ProjectView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sec="clr-namespace:Projecturo.ProjecturoClient.Security"
    Width="Auto" Height="Auto">
    
    <DockPanel LastChildFill="True">
        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
            <Button Content="Project Administration" Command="{Binding OpenProjectAdministrationCommand}" Visibility="{x:Static sec:SecurityDescriptor.IsAdminVisibility}"/>
            <Button Content="New Ticket" Command="{Binding NewTicketCommand}" CommandParameter="{Binding Id}" />
            <Button Content="Save" Command="{Binding SaveCommand}"/>
        </StackPanel>
        <DockPanel LastChildFill="True">
            <StackPanel DockPanel.Dock="Left">
                <GroupBox Header="Details">
                    <StackPanel>
                        <TextBlock Text="Project Number"/>
                        <TextBlock Text="{Binding Id}"/>
                        <TextBlock Text="Name"/>
                        <TextBox Text="{Binding Name}"/>
                        <TextBlock Text="Description"/>
                        <TextBox Text="{Binding Description}" MinLines="5" AcceptsReturn="True" AcceptsTab="True"/>
                        <TextBlock Text="Default Ticket State"/>
                        <ComboBox Grid.Column="3" Grid.Row="0" SelectedValuePath="Id" SelectedValue="{Binding StateId}"  ItemsSource="{Binding AvailableTicketStates}"/>
                        <TextBlock Text="Planned Effort (Hours)"/>
                        <TextBox Text="{Binding PlannedEffortHours,Mode=OneWay}" IsReadOnly="True"/>
                        <TextBlock Text="Total Effort (Hours)"/>
                        <TextBox Text="{Binding SpentEffortHours,Mode=OneWay}" IsReadOnly="True"/>
                    </StackPanel>
                </GroupBox>
            </StackPanel>
            <GroupBox Header="Tickets">
                <ListView ItemsSource="{Binding Tickets}" BorderThickness="0" Margin="4">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}"/>
                            <GridViewColumn CellTemplate="{StaticResource EditTicketTemplate}" Header="Name"/>
                            <GridViewColumn Header="Version" DisplayMemberBinding="{Binding Version.Name}"/>
                            <GridViewColumn Header="Category" DisplayMemberBinding="{Binding Category.Name}"/>
                            <GridViewColumn Header="Milestone" DisplayMemberBinding="{Binding Milestone.Name}"/>
                            <GridViewColumn CellTemplate="{StaticResource DashboardTicketStateStyle}" Header="Status"/>
                            <GridViewColumn Header="Editor" DisplayMemberBinding="{Binding AssignedTo.ShortName}"/>
                            <GridViewColumn Header="Reporter" DisplayMemberBinding="{Binding CreatedBy.ShortName}"/>
                            <GridViewColumn Header="Last Change" DisplayMemberBinding="{Binding Path=ChangeDate,StringFormat={}{0:d}}"/>
                        </GridView>
                    </ListView.View>
                </ListView>
                <!--<tk:DataGrid x:Name="ProjectsGrid" ItemsSource="{Binding Tickets}" AutoGenerateColumns="False">
                    <tk:DataGrid.Columns>
                        <tk:DataGridTextColumn Header="Number" Binding="{Binding Id}" SortMemberPath="Number" IsReadOnly="True"/>
                        <tk:DataGridTextColumn Header="Name" Binding="{Binding Name}" SortMemberPath="Name" IsReadOnly="True"/>
                        <tk:DataGridTextColumn Header="Version" Binding="{Binding Version.Name}" SortMemberPath="Version.Name" IsReadOnly="True"/>
                        <tk:DataGridTextColumn Header="Category" Binding="{Binding Category.Name}" SortMemberPath="Category.Name" IsReadOnly="True"/>
                        <tk:DataGridTextColumn Header="Type" Binding="{Binding Type}" SortMemberPath="Type" IsReadOnly="True"/>
                        <tk:DataGridTextColumn Header="Priority" Binding="{Binding Priority}" SortMemberPath="Priority" IsReadOnly="True"/>
                        <tk:DataGridTextColumn Header="Assigned To" Binding="{Binding AssignedTo.ShortName}" SortMemberPath="AssignedTo.ShotName" IsReadOnly="True"/>
                        <tk:DataGridTemplateColumn Header="Edit" CellTemplate="{StaticResource EditTicketTemplate}"/>
                    </tk:DataGrid.Columns>
                </tk:DataGrid>-->
            </GroupBox>
        </DockPanel>
    </DockPanel>
</UserControl>
